package model.pojo;

import java.sql.ResultSet;

import models.util.MySqlDataAccessHelper;

public class AcLoaiTaiKhoanC1 {

	private String idloaitkc1;
	private String tenloaitkc1;
	private String idloaitk;
	private String ghichu;
	private String flag;
	private boolean checkTKC1;

	public AcLoaiTaiKhoanC1() {

	}

	public AcLoaiTaiKhoanC1(String idloaitkc1, String tenloaitkc1) {
		this.idloaitkc1 = idloaitkc1;
		this.tenloaitkc1 = tenloaitkc1;
	}

	public boolean isCheckTKC1() {
		return checkTKC1;
	}

	public void setCheckTKC1(boolean checkTKC1) {
		this.checkTKC1 = checkTKC1;
	}

	public String getFlag() {
		return flag;
	}

	public void setFlag(String flag) {
		this.flag = flag;
	}

	private AcLoaiTaiKhoan infoLoaitk;

	public String getIdloaitkc1() {
		return idloaitkc1;
	}

	public void setIdloaitkc1(String idloaitkc1) {
		this.idloaitkc1 = idloaitkc1;
	}

	public String getTenloaitkc1() {
		return tenloaitkc1;
	}

	public void setTenloaitkc1(String tenloaitkc1) {
		this.tenloaitkc1 = tenloaitkc1;
	}

	public String getIdloaitk() {
		return idloaitk;
	}

	public void setIdloaitk(String idloaitk) {
		this.idloaitk = idloaitk;
	}

	public String getGhichu() {
		return ghichu;
	}

	public void setGhichu(String ghichu) {
		this.ghichu = ghichu;
	}

	public AcLoaiTaiKhoan getInfoLoaitk() {
		MySqlDataAccessHelper mysql = new MySqlDataAccessHelper();

		try {
			mysql.open();
			String sql = "select * from ac_loaitaikhoan where ac_loaitaikhoan.IDLoaiTK='"
					+ this.idloaitk + "'";
			ResultSet rs = mysql.executeQuery(sql);
			if (rs.next()) {
				infoLoaitk = new AcLoaiTaiKhoan();
				infoLoaitk.setIdloaitk(rs.getString("IDLoaiTK"));
				infoLoaitk.setTenloaitk(rs.getString("TenLoaiTK"));
				infoLoaitk.setGhichu(rs.getString("GhiChu"));
			}
			rs.close();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			mysql.close();
		}

		return infoLoaitk;
	}

	public void setInfoLoaitk(AcLoaiTaiKhoan infoLoaitk) {
		this.infoLoaitk = infoLoaitk;
	}

}
